package net.tycmc.cty.ctyms.web.Action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;


import net.tycmc.bulb.common.util.DateUtil;
import net.tycmc.cty.ctyms.timejob.common.DateRegUtil;
import net.tycmc.cty.ctyms.timejob.iems.service.VclLoadRemedyStatService;

public class VclLoadRemedyHandRunAction extends BaseActionS2{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private VclLoadRemedyStatService vclLoadRemedyStatService;

	public VclLoadRemedyStatService getVclLoadRemedyStatService() {
		return vclLoadRemedyStatService;
	}


	public void setVclLoadRemedyStatService(
			VclLoadRemedyStatService vclLoadRemedyStatService) {
		this.vclLoadRemedyStatService = vclLoadRemedyStatService;
	}
	

	/**
	 * 初始化方法，用于跳转
	 * @return
	 */
	public String vclLoadRemedyHandRunInit(){
		request.setAttribute("today", DateUtil.addDay(0));
		return "vclLoadRemedyHandRunInit";
	}
	
	/**
	 * 执行
	 * @return
	 * @throws IOException 
	 */
	public String handStatVclLoadRemedy() throws IOException{
 		String beTime=request.getParameter("beTime");
		String endTime=request.getParameter("endTime");
		List<String>list=DateRegUtil.iterateTime(beTime, endTime);
		for(int i=list.size()-1;i>=0;i--){
			//这次统计时间
			String thisWorkDay =list.get(i);
			//统计数据
			vclLoadRemedyStatService.startWork(thisWorkDay);
		}
		PrintWriter out = response.getWriter();
		out.print("{'status':'1'}");
		return null;
	}
	
}
